<?php 
namespace app\admin\controller;

use cmf\controller\AdminBaseController;
use think\Db;

	class RentController extends AdminBaseController
	{

		/*园区房间列表页*/	
		public function index(){
			// var_dump($_POST);
			// exit;
			$where=array();
			// $site_type = $this->request->param('site_type_id',0);
			// // $where['status']=0;
			// if($site_type){
			// 	$where['site_type_id'] = $site_type;	
			// }

			// /**搜索条件**/
			// $site_name = $this->request->param('site_name');
			// $address = $this->request->param('address');

			// if ($site_name) {
			// 	$where['site_name'] = ['like', "%$site_name%"];
			// }
			 $order_id = $this->request->param('order_id');
			 $order_into = $this->request->param('order_into');
			 if($order_id){
			 	$where['order_id']=$order_id;
			 }
			 $status = $this->request->param('status');
			if ($status) {
				$where['status'] = $status;
			}

			if(session('incubator_id')){
				$where['incubator_id']=session('incubator_id');
			}	
			$list=Db::name('rent')->where($where)->paginate(10);
			// echo Db::name('site')->getLastSql();
			// dump($list);
			//$list=Db::name('station')->alias('a')->join('cx_incubator w','w.id=a.incubator_id')->paginate(5);
			$page=$list->render();
			$this->assign("order_into",$order_into);
			$this->assign("page", $page);
			$this->assign('status',$status);
			$this->assign("list", $list);
			return $this->fetch();
		}



		/*删除园区*/
		public function payStatus(){
		
			$data['id']= $this->request->param('id',0,'intval');
			$data['status']= $this->request->param('status',1,'intval');
			$pay=Db::name('rent')->update($data);
			if($pay){
				return info_back('','支付状态更改成功',true);
			}else{
				return info_back('','支付状态更改失败失败',false);
			}

		}	

      





















	}